package com.ai_chat.sys.service.impl;

import com.ai_chat.sys.entity.Qa;
import com.ai_chat.sys.mapper.QaMapper;
import com.ai_chat.sys.service.IQaService;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;


@Service
public class QaServiceImpl extends ServiceImpl<QaMapper, Qa> implements IQaService {

    @Autowired
    private QaMapper qaMapper;

    public void insertQRecord(Qa q){
        qaMapper.insert(q);
    }

    public void insertARecord(Qa a){
        qaMapper.insert(a);
    }

    public List<Qa> getQaListInTopic(Integer topicId){
        LambdaQueryWrapper<Qa> condition = new LambdaQueryWrapper<>();
        condition.eq(Qa::getTopicId,topicId);
        return qaMapper.selectList(condition);
    }
}
